package com.yjd.bi.first.dao.impl;

import com.yjd.bi.first.dao.IAppPayFirstDao;
import com.yjd.bi.first.model.AppPayFirstModel;
import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;

/**
 * <b>description</b>：首次充值记录数据访问层 <br>
 * <b>time</b>：2017-04-01 16:24:01 <br>
 * <b>author</b>： carl
 */
@Component("appPayFirstDao")
public class AppPayFirstDaoImpl extends BaseDaoImpl implements IAppPayFirstDao {

    private static final String SQLMAPNAMESPACE = AppPayFirstModel.class.getName();
    private static final String PKNAME = "app_user_id";

    @Override
    public String getPrimaryKeyName() {
        return PKNAME;
    }

    @Override
    public String getSqlmapNamespace() {
        return SQLMAPNAMESPACE;
    }

    @Override
    public List<AppPayFirstModel> getAppFirstList(Map param) throws Exception {
        return (List<AppPayFirstModel>) this.getSqlMap(false).queryForList(this.getStatement("getAppFirstList"), param);
    }


    @Override
    public Double getFirstPayUseTimes(Map param) throws Exception {
        Object myObject = this.getSqlMap(false).queryForObject(this.getStatement("getFirstPayUseTimes"),param);
        if (myObject != null) {
            return Double.parseDouble(myObject.toString());
        }
        return 0.00D;
    }
}
